<?php

class Application_Model_Przesylka
{

    protected $_id_przesylka;
    protected $_id_nad;
    protected $_odbiorca;
    protected $_waga;
    protected $_pobranie;
    protected $_adres;
    protected $_miasto;
    protected $_nadawca;
    protected $_stan;
    protected $_szerokosc;
    protected $_wysokosc;
    protected $_glebokosc;

    //   protected $_kierunek;

    public function __construct(array $options = null)
    {
        if (is_array($options))
        {
            $this->setOptions($options);
        }
    }

    public function __set($name, $value)
    {
        $metoda = 'set' . ucfirst($name);

        if (('mapper' == $name) || !method_exists($this, $metoda))
        {
            throw new exception('Nie ma takiej wĹ‚aĹ›ciwoĹ›Ä‡i!');
        }

        $this->$metoda($value);
    }

    public function __get($name)
    {
        $metoda = 'get' . ucfirst($name);

        if (('mapper' == $name) || !method_exists($this, $metoda))
        {
            throw new exception('Nie ma takiej wĹ‚aĹ›ciwoĹ›Ä‡i!');
        }

        $this->$metoda();
    }

    public function setOptions(array $options)
    {
        $methods = get_class_methods($this);

        foreach ($options as $key => $value)
        {
            $method = 'set' . ucfirst($key);
            if (in_array($method, $methods))
            {
                $this->$method($value);
            }
        }
        return $this;
    }

    public function setIdPrzesylka($id)
    {
        $this->_id_przesylka = (int) $id;
        return $this;
    }

    public function getIdPrzesylka()
    {
        return $this->_id_przesylka;
    }

    public function setIdNadawca($id_nad)
    {
        $this->_id_nad = (int)$id_nad;
        return $this;
    }

    public function getIdNadawca()
    {
        return $this->_id_nad;
    }

    public function setOdbiorca($odbiorca)
    {
        $this->_odbiorca = $odbiorca;
        return $this;
    }

    public function getOdbiorca()
    {
        return $this->_odbiorca;
    }

    public function setWaga($waga)
    {
        $this->_waga = (int) $waga;
        return $this;
    }

    public function getWaga()
    {
        return $this->_waga;
    }
    
    public function setSzerokosc($szerokosc)
    {
        $this->_szerokosc = (int) $szerokosc;
        return $this;
    }

    public function getSzeorkosc()
    {
        return $this->_szerokosc;
    }
    
    public function setWysokosc($wysokosc)
    {
        $this->_wysokosc = (int) $wysokosc;
        return $this;
    }

    public function getWysokosc()
    {
        return $this->_wysokosc;
    }
    
    public function setGlebokosc($glebokosc)
    {
        $this->_glebokosc = (int) $glebokosc;
        return $this;
    }

    public function getGlebokosc()
    {
        return $this->_glebokosc;
    }

    public function setPobranie($pobranie)
    {
        $this->_pobranie = (int) $pobranie;
        return $this;
    }

    public function getPobranie()
    {
        return $this->_pobranie;
    }

    public function setAdres($adres)
    {
        $this->_adres = (string) $adres;
        return $this;
    }

    public function getAdres()
    {
        return $this->_adres;
    }

    public function setMiasto($miasto)
    {
        $this->_miasto = (string) $miasto;
        return $this;
    }

    public function getMiasto()
    {
        return $this->_miasto;
    }
    
    public function setNadawca($nadawca)
    {
        $this->_nadawca = (string) $nadawca;
        return $this;
    }

    public function getNadawca()
    {
        return $this->_nadawca;
    }
    
    public function setStan($stan)
    {
        $this->_stan = (int) $stan;
        return $this;
    }

    public function getStan()
    {
        return $this->_stan;
    }
}

